package com.example.initmethoddemo;

import java.util.Scanner;

/**
 * @Description: 数组查询的dmeo
 * @author: LiuYC
 * @date: 2021年04月25日 9:00
 */
public class StrNumDemo {
    public static void main(String[] args) {
        String[] strings = {"liuyuchao", "han"};
        Scanner scanner = new Scanner(System.in);
        System.out.println("请输入姓名：");
        String name = scanner.nextLine();
        boolean flag = false;
        for (int i = 0; i < strings.length; i++) {
            if (name.equals(strings[i])) {
                flag = true;
                break;
            }
        }
        if (flag) {
            System.out.println("输入的名字存在：" + name);
        } else {
            System.out.println("输入的名字不存在：" + name);
        }
    }
}
